public abstract class Shape implements Cloneable {
    private String type;
    private String color;

    public Shape(String type, String color) {
        this.type = type;
        this.color = color;
    }

    // 抽象方法（由子类实现具体绘制逻辑）
    public abstract void draw();

    // 重写 clone() 方法实现浅拷贝
    @Override
    public Shape clone() {
        try {
            return (Shape) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new RuntimeException("克隆失败", e);
        }
    }

    // Getter & Setter
    public String getType() { return type; }
    public String getColor() { return color; }
    public void setColor(String color) { this.color = color; }
}
